<%function IsValidEmail(email)

	dim names, name, i, c

	'Check for valid syntax in an email address.
	IsValidEmail = true
	names = Split(email, "@")
	if UBound(names) <> 1 then
	   IsValidEmail = false
	   exit function
	end if
	for each name in names
	   if Len(name) <= 0 then
		 IsValidEmail = false
		 exit function
	   end if
	   for i = 1 to Len(name)
		 c = Lcase(Mid(name, i, 1))
		 if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
		   IsValidEmail = false
		   exit function
		 end if
	   next
	   if Left(name, 1) = "." or Right(name, 1) = "." then
		  IsValidEmail = false
		  exit function
	   end if
	next
	if InStr(names(1), ".") <= 0 then
	   IsValidEmail = false
	   exit function
	end if
	i = Len(names(1)) - InStrRev(names(1), ".")
	if i <> 2 and i <> 3 And i<>4 then
	   IsValidEmail = false
	   exit function
	end if
	if InStr(email, "..") > 0 then
	   IsValidEmail = false
	end if

end function



function IsValidTel(para)
	on error resume next
	dim str
	dim l,i
	if isNUll(para) then 
		IsValidTel=false
		exit function
	end if
	str=trim(cstr(para))
	l=len(str)
	if l<7 or l>20 then
		IsValidTel=false
		exit function
	end if
	for i=1 to l
		if not (mid(str,i,1)>="0" and mid(str,i,1)<="9" or mid(str,i,1)="-") then
			IsValidTel=false 
			exit function
		end if
	next
	IsValidTel=true
	if err.number<>0 then err.clear
end function



function isValidstring(para)
	on error resume next
	dim str,c
	dim l,i,invalidchar
	invalidchar="=%?#&;,'+<>()-:\*!/|"&chr(32)&chr(34)&chr(9)
	if isNUll(para) then 
		isValidstring=""
		exit function
	end if
	str=cstr(para)
	if trim(str)="" then
		isValidstring=""
		exit function
	end if
	l=len(str)
	for i = 1 to l
		c = Mid(str, i, 1)
		if InStr(invalidchar,c)>0 then
			isValidstring = c
			exit function
		end if
	next
	isValidstring=""
	if err.number<>0 then err.clear
end function


function isChinese(para)
	on error resume next
	dim str,i,c
	isChinese=false
	if isNUll(para) then exit function
	str=cstr(para)
	if trim(str)="" then exit function
	for i=1 to len(str)
	   c=asc(mid(str,i,1))
		 if c>=0 then exit function
	next
	isChinese=true
	if err.number<>0 then err.clear
end function

%>